package chap06.task5;

import com.sun.org.apache.bcel.internal.generic.BranchHandle;
import com.sun.org.apache.bcel.internal.generic.NEW;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;


/**
 * Create by IntelliJ IDEA
 *
 * @author: jsonor
 * @date-Time: 2018/5/4 9:11
 * @description:
 */
public class CopyFile1 {
  public static void main(String[] args) {
    BufferedReader  br = null;
    BufferedWriter be=null;
    try {
      br = new BufferedReader(new FileReader("a.txt"));
      be = new BufferedWriter(new FileWriter("c:\\a.txt"));
      String len=null;
      while ((len= br.readLine())!=null){
        be.write(len);
        be.newLine();
      }
      br.close();
      be.close();
    } catch (Exception e) {
      System.out.println(e.getCause());
    }finally {
      if(br!=null){
          try {
            br.close();
          } catch (IOException e) {
            e.printStackTrace();
          }
      }
    }if(be!=null){
        try {
          be.close();
        } catch (IOException e) {
          e.printStackTrace();
        }
    }
  }
}
